class MinStack:
    # 一个支持 push ，pop ，top 操作，并能在常数时间内检索到最小元素的栈
    def __init__(self):
        """
        initialize your data structure here.
        """
        self.data = []
        self.min_ = 0xffffffffffffffff


    def push(self, val: int) -> None:
        if not self.data:
            self.min_ = val
        self.data.append(val)
        if val < self.min_:
            self.min_ = val


    def pop(self) -> None:
        self.data.pop()
        if self.data:
            self.min_ = min(self.data)


    def top(self) -> int:
        return self.data[-1]


    def getMin(self) -> int:
        return int(self.min_)


# Your MinStack object will be instantiated and called as such:
# obj = MinStack()
# obj.push(val)
# obj.pop()
# param_3 = obj.top()
# param_4 = obj.getMin()
